multiply.test.ts
thoward37@gmail.com/shirt[add-multiply-b-function-new-file] / multiply.test.ts
@ b0a62ee2
Download
Ladder Summary
- file Add unit tests for the multiply function
import { describe, it } from "node:test";
import { strict as assert } from "node:assert";
import { multiply } from "./multiply.ts";
describe("multiply", () => {
it("should return the product of two positive numbers", () => {
assert.equal(multiply(3, 4), 12);
});
it("should handle negative numbers correctly", () => {
assert.equal(multiply(-2, 5), -10);
assert.equal(multiply(-3, -7), 21);
});
it("should return zero when one operand is zero", () => {
assert.equal(multiply(0, 10), 0);
assert.equal(multiply(7, 0), 0);
});
});